﻿@page  "/system_manager/audit-entity"
@inherits TableBase<AuditEntityDto, Guid>
<div>
    <Table @ref="_table"
           TItem="AuditEntityDto"
           DataSource="@_datas"
           Total="_total"
           OnChange="@OnChange"
           @bind-PageIndex="_pageIndex"
           @bind-PageSize="_pageSize"
           @bind-SelectedRows="_selectedRows"
           Loading="@_tableIsLoading"
           Context="model">
        <TitleTemplate>
             <ResourceAuthorize ResourceKey="system_manager_audit_entity_refresh">
                <TableSearch TDto="AuditEntityDto" OnSearchFieldChanged="SetPresetFilterGroups" OnSearch="()=>ReLoadTable(true)" DefaultValue="_defaultSearchValue"></TableSearch>
             </ResourceAuthorize>
            <Row>
                <AntDesign.Col Span="8">
                    <ResourceAuthorize ResourceKey="system_manager_audit_entity_delete_selected">
                        <Button Type="@ButtonType.Primary" Icon="delete" Danger OnClick="OnClickDeletes" Loading="_deletesBtnLoading">
                            @localizer["删除选中"]
                        </Button>
                    </ResourceAuthorize>
                </AntDesign.Col>
                <AntDesign.Col Span="16" Style="text-align:right">
                    <Space>
                        <ResourceAuthorize ResourceKey="system_manager_audit_entity_refresh">
                            <SpaceItem>
                                <Button Type="@ButtonType.Primary" Icon="reload" OnClick="ReLoadTable">
                                    @localizer["刷新"]
                                </Button>
                            </SpaceItem>
                        </ResourceAuthorize>
                    </Space>
                </AntDesign.Col>
            </Row>
        </TitleTemplate>
        <RowTemplate>
            <ResourceAuthorize ResourceKey="system_manager_audit_entity_delete_selected">
                <Selection Key="@(model.Id.ToString())" />
            </ResourceAuthorize>
            <Column @bind-Field="@model.OperaterId" Filterable />
            <Column @bind-Field="@model.OperaterName" Filterable />
            <Column @bind-Field="@model.OperaterType" Filters="TableFiltersConstants.IdentityTypeFilters">
                <TagRandomColor Text="@EnumHelper.GetEnumDescription(model.OperaterType)"></TagRandomColor>
            </Column>
            <Column @bind-Field="@model.Name" Filterable />
            <Column @bind-Field="@model.TypeName" Filterable />
            <Column @bind-Field="@model.DataId" Width="300" />
            <Column @bind-Field="@model.OperationType" Filters="TableFiltersConstants.OperationTypeFilters">
                <Tag>@EnumHelper.GetEnumDescription(model.OperationType)</Tag>
            </Column>
            <Column @bind-Field="@model.CreatedTime" Format="@ClientConstant.DateTimeFormat" Sortable DefaultSortOrder="@SortDirection.Descending" />
            <ActionColumn>
                <Space>
                    <ResourceAuthorize ResourceKey="system_manager_audit_entity_detail">
                        <SpaceItem>
                            <Tooltip Title="@(localizer["详情"])" ArrowPointAtCenter="true">
                                <Button Icon="read" Type="@ButtonType.Primary" OnClick="()=>OnDetailClick(model)"></Button>
                            </Tooltip>
                        </SpaceItem>
                    </ResourceAuthorize>
                    <ResourceAuthorize ResourceKey="system_manager_audit_entity_delete">
                        <SpaceItem>
                            <Tooltip Title="@(localizer["删除"])" ArrowPointAtCenter="true">
                                <Button Icon="delete" Type="@ButtonType.Primary" Danger OnClick="()=>OnClickDelete(model.Id)"></Button>
                            </Tooltip>
                        </SpaceItem>
                    </ResourceAuthorize>
                </Space>
            </ActionColumn>
        </RowTemplate>
    </Table>
</div>